package com.itheima.health.common;


import lombok.Data;

@Data
public class Result<T> {
    private boolean flag;
    private String message;
    private T data;

    public static <E> Result<E> success(E data) {
        Result result = new Result();
        result.flag = true;
        result.message = "OK";
        result.data = data;
        return result;
    }

    public static <E> Result<E> error(String msg) {
        Result result = new Result();
        result.flag = false;
        result.message = msg;
        return result;
    }

    public static <E> Result<E> success() {
        Result result = new Result();
        result.flag = true;
        result.message = "OK";
        return result;
    }

}
